interface ResponseProps {
  code: string;
  msg: string;
  data: any;
}

// 获取方向
export const subjectApi = () =>
  new Promise<ResponseProps>((resolve) => {
    resolve({
      code: "200",
      msg: "",
      data: {
        subject: [
          {
            name: "前端",
            value: "前端id",
          },
          {
            name: "java",
            value: "java id",
          },
        ],
      },
    });
  });

// 获取阶段
// interface LevelListProps {
//   startLevel: number; // 阶段开始天数
//   endLevel: number; // 阶段结束天数
//   text: string; // 阶段名称
//   value: number; // 阶段 id
// }
export const levelListApi = () =>
  new Promise<ResponseProps>((resolve) => {
    resolve({
      code: "200",
      msg: "",
      data: {
        ItemsTitile: [
          {
            text: "一阶段",
            value: "一阶段id",
            start_level: 1,
            end_level: 7,
          },
          { text: "二级段", value: "二阶段id", start_level: 8, end_level: 31 },
          { text: "三阶段", value: "三阶段id", start_level: 32, end_level: 52 },
          { text: "四阶段", value: "四阶段id", start_level: 53, end_level: 92 },
          {
            text: "五阶段",
            value: "五阶段id",
            start_level: 93,
            end_level: 110,
          },
        ],
      },
    });
  });

// 生成试卷
export interface GenerateExaminationApiProps {
  examCount: number; // 考题数量,例如30/50/100
  examTypeId: number; // 考试类型编号
  levelArrayId: Array<number>; // level集合
  stuId: number; // 学生编号,预留字段
  subjectId: number; // 学科方向编号
}
export const generateExaminationApi: (
  data: GenerateExaminationApiProps
) => Promise<ResponseProps> = (data) =>
  new Promise((resolve) => {
    console.log("收到生成试卷参数", data);

    resolve({
      code: "200",
      msg: "",
      data: {
        recoredId: 1, // 考题记录 id
        alluestion: [
          {
            id: 1, // 考题编号
            title: "考题标题",
            type: 1, // 考题类型, 1-单选 2-多选 3-判断 4-填空
            correct: ["A", "B"], // 本题正确答案
            styleIndex: 0, // 默认样式为 boxStyle 的第0项 default-box
            results: [
              {
                option: "A", // 选项A
                value: 1, // 选项值
              },
              {
                option: "B",
                value: 2,
              },
              {
                option: "C",
                value: 3,
              },
              {
                option: "D",
                value: 4,
              },
            ],
          },
        ],
      },
    });
  });
